﻿<UserControl x:Class="Graphing.View.FormulaView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ViewModel="clr-namespace:Graphing.ViewModel"
             mc:Ignorable="d" >
    
    <UserControl.Resources>
        <ViewModel:FormulaViewModel x:Key="FormulaViewModel" />
    </UserControl.Resources>

    <Grid DataContext="{StaticResource FormulaViewModel}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MaxWidth="50" />
            <ColumnDefinition />
            <ColumnDefinition MaxWidth="40" />
            <ColumnDefinition MaxWidth="40" />
            <ColumnDefinition MaxWidth="40" />
            <ColumnDefinition MaxWidth="40" />
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="25" />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        
        <!-- F(x) Label -->
        <Label Content="f(x) =" Grid.Column="0" Grid.Row="0" MinHeight="25" MinWidth="50" Name="LblFunctionHeader" />

        <!-- Expression Text Box -->
        <TextBox Text="{Binding Path=Expression, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.ColumnSpan="6" Grid.Row="0" MinHeight="25" MinWidth="500" Name="TxtFormula" />
        
        <!-- Graph Button -->
        <Button Content="Graph" Grid.Column="7" Grid.Row="0" MinHeight="25" MinWidth="75" Name="BtnGraph" Focusable="False" />

    <!-- Buttons. -->
        <!-- Left Parenthesis -->
        <Button Content="(" Grid.Column="2" Grid.Row="2" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="(" MinHeight="30" MinWidth="40" Name="BtnLeftParenthesis" Focusable="False" />
        
        <!-- Right Parenthesis -->
        <Button Content=")" Grid.Column="3" Grid.Row="2" Command="{Binding Path=FormulaButtonCommand}" CommandParameter=")" MinHeight="30" MinWidth="40" Name="BtnRightParenthesis" Focusable="False" />
        
        <!-- Root -->
        <Button Content="√" Grid.Column="4" Grid.Row="2" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="√" MinHeight="30" MinWidth="40" Name="BtnRoot" Focusable="False" />

        <!-- Power -->
        <Button Content="x^y" Grid.Column="5" Grid.Row="2" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="^" MinHeight="30" MinWidth="40" Name="BtnPower" Focusable="False" />

        <!-- Pi (π) -->
        <Button Content="π" Grid.Column="5" Grid.Row="3" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="π" MinHeight="30" MinWidth="40" Name="BtnPi" Focusable="False" />

        <!-- e -->
        <Button Content="e" Grid.Column="4" Grid.Row="3" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="e" MinHeight="30" MinWidth="40" Name="BtnE" Focusable="False" />
        
        <!-- x -->
        <Button Content="x" Grid.Column="2" Grid.Row="3" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="x" MinHeight="30" MinWidth="40" Name="BtnX" Focusable="False" />
        
        <!-- y -->
        <Button Content="y" Grid.Column="3" Grid.Row="3" Command="{Binding Path=FormulaButtonCommand}" CommandParameter="y" MinHeight="30" MinWidth="40" Name="BtnY" Focusable="False" />
    </Grid> 
</UserControl>
